package sk.naive.talker.server;

import sk.naive.talker.*;
import sk.naive.talker.adapter.Adapter;
import sk.naive.talker.props.*;

import java.rmi.RemoteException;
import java.util.*;
import java.io.IOException;

/**
 *
 * @author <a href="mailto:virgo@naive.deepblue.sk">Richard "Virgo" Richter</a>
 * @version $Revision: 1.12 $ $Date: 2005/01/06 20:54:27 $
 */
public class AdapterProxy
	implements sk.naive.talker.AdapterProxy
{
	private	Adapter remoteAdapter;
	private Set settable;
	private Set persistent;
	private Set userProperties;

	public AdapterProxy(Adapter remoteAdapter, Set settable, Set persistent, Set userProperties) {
		this.remoteAdapter = remoteAdapter;
		this.settable = settable;
		this.persistent = persistent;
		this.userProperties = userProperties;
	}

	public void disconnect(User user) throws RemoteException {
		remoteAdapter.disconnect(user.getRemoteUser());
	}

	public String getName() throws RemoteException {
		return remoteAdapter.getName();
	}

	public void shutdown() throws IOException {
		remoteAdapter.shutdown();
	}

	public Set getSettable() {
		return settable;
	}

	public Set getPersistent() {
		return persistent;
	}

	public Set getUserProperties() {
		return userProperties;
	}

	public Object get(String property) throws RemoteException {
		return remoteAdapter.get(property);
	}

	public void set(String property, Object value)
		throws RemoteException,
		PropertyStoreException
	{
		remoteAdapter.set(property, value);
	}

	public Property getProperty(String property) throws RemoteException {
		throw new UnsupportedOperationException();
	}
}
